from bittrex.bittrexAPI import *

def GetCoinNum(coinjson, ak, sk):
    bfc = Bittrex(ak, sk)
    coins = bfc.get_balances()
    #print(coins)
    myCoins = coins['result']
    for i in myCoins:
        num = (float)(i['Balance'])
        if num > 0:
            if (i['Currency'].lower() in coinjson.keys()):
                coinjson[i['Currency'].lower()] = coinjson[i['Currency'].lower()] + num
            else:
                coinjson[i['Currency'].lower()] = num

if __name__ == '__main__':
    ak = '7b6956c53aac4fe0b8bec5ebd7ae69d1'
    sk = '6cd944c1c0f144b590e9a7c61102d823'
    coinjson = json.loads('{}')
    GetCoinNum(coinjson, ak, sk)
    print(coinjson)